import request from '@/utils/request'

/**
* 煤场盘存入库记录分页查询
* @param {查询条件} data
*/
export function listFuelWorkTInventoryInfo(query: any) {
    return request({
        url: "business/FuelWorkTInventoryInfo/list",
        method: "get",
        params: query
    });
}

export function getFuelWorkTInventoryById(id: any) {
    return request({
        url: `/business/FuelBunkerTRecord/threeDimension/${id}`,
        // url: `business/FuelWorkTInventoryInfo/getWorkRecordList?id=${id}`,
        method: "get"
    });
}
export function getTheLatestyorkRecord(id: number, executeId?: number) {
    executeId = executeId || 0;
    if (executeId > 0) {
        return request({
            url: `/business/FuelWorkTInventoryInfo/getTheLatestWorkRecord/${id}/${executeId}`,
            // url: `business/FuelWorkTInventoryInfo/getWorkRecordList?id=${id}`,
            method: "get"
        });
    }

    return request({
        url: `/business/FuelWorkTInventoryInfo/getTheLatestWorkRecord/${id}`,
        // url: `business/FuelWorkTInventoryInfo/getWorkRecordList?id=${id}`,
        method: "get"
    });
}


/**
* 新增煤场盘存入库记录
* @param data
*/
export function addFuelWorkTInventoryInfo(data: any) {
    return request({
        url: "business/FuelWorkTInventoryInfo",
        method: "post",
        data: data
    });
}

/**
* 修改煤场盘存入库记录
* @param data
*/
export function updateFuelWorkTInventoryInfo(data: any) {
    return request({
        url: "business/FuelWorkTInventoryInfo",
        method: "PUT",
        data: data
    });
}

/**
* 获取煤场盘存入库记录详情
* @param {executeId}
*/
export function getFuelWorkTInventoryInfo(executeId: any) {
    return request({
        url: `business/FuelWorkTInventoryInfo/${executeId}`,
        method: "get"
    });
}

/**
* 删除煤场盘存入库记录
* @param {主键} pid
*/
export function delFuelWorkTInventoryInfo(pid: string) {
    return request({
        url: 'business/FuelWorkTInventoryInfo/' + pid,
        method: 'delete'
    });
}

// 清空煤场盘存入库记录
export function clearFuelWorkTInventoryInfo() {
    return request({
        url: 'business/FuelWorkTInventoryInfo/clean',
        method: 'delete'
    });
}

// 导出煤场盘存入库记录
export async function exportFuelWorkTInventoryInfo(query: any) {
    // await downFile('business/FuelWorkTInventoryInfo/export', { ...query });
}

/**
 * 
 * @param id
 * @param queryDate
 * @returns
 */
export function getHistory(id: number, queryDate: string) {
    return request({
        url: `/business/FuelWorkTInventoryInfo/getHistory/${id}/${queryDate}`,
        method: "get"
    });
}